#!/user/bin/env python3
# -*- coding: utf-8 -*-
"""
--------------------------------------
    Author:     JiChao_Song
    Date  :     2020/12/11 16:22
    Desc  :
--------------------------------------
"""
from bson import json_util
from application import mongo


class Project(mongo.Document):
    """
    项目表
    """
    projectName = mongo.StringField(require = True, unique = True)
    projectUrl = mongo.StringField()
    projectDesc = mongo.StringField()
    projectUsername = mongo.StringField(require = True)
    projectUserphone = mongo.StringField(require = True)

    def to_json(self):
        return {
            '_id': eval(json_util.dumps(self.id)),
            'projectName': self.projectName,
            'projectUrl': self.projectUrl,
            'projectDesc': self.projectDesc,
            'projectUsername': self.projectUsername,
            'projectUserphone': self.projectUserphone,
        }

